import { Component, OnInit } from '@angular/core';

// import { Hero } from '../hero';
// import { HEROES } from '../mock-heroes';

import { Holidays, postPatchHolidays } from '../../domain/holidays';
import { HolidayService } from '../../service/holiday.service';
import { UserService } from '../../service/user.service';
import { adminUser } from '../../domain/user';

@Component({
  selector: 'app-staff-leave-record',
  templateUrl: './staff-leave-record.component.html',
  styleUrls: ['./staff-leave-record.component.css']
})
export class StaffLeaveRecordComponent implements OnInit {

  // heroes = HEROES;
  // selectedHero: Hero;

  // holidays : Holidays[];
  // selectedHoliday : Holidays;
  // patchHoliday: Holidays;

  adminUsers: adminUser[];

  constructor(private holidayService: HolidayService, private userService: UserService) { 

  }

  // managePatchHolidays(flag: string, reason: string) {
  //   if(flag === "通过") {
  //     flag = "true"
  //     var tempHolidays: postPatchHolidays = new postPatchHolidays(flag, reason, this.userService.sharedUser.username);
  //     this.holidayService.patchHolidays(tempHolidays, this.selectedHoliday.pk)
  //       .then(res => res = this.patchHoliday)
  //   } else {
  //     flag = "false"
  //     var tempHolidays: postPatchHolidays = new postPatchHolidays(flag, reason, this.userService.sharedUser.username);
  //     this.holidayService.patchHolidays(tempHolidays, this.selectedHoliday.pk)
  //       .then(res => res = this.patchHoliday)
  //   }
  // }

  ngOnInit() {
    this.userService.getyearsHoliday().then((getUsers) => {
      this.adminUsers = getUsers
    })
  }
}
